package StudentsManage;

import java.util.Scanner;

import static StudentsManage.Student.students;

public class AddStu {
    public static void addStu() {
        //输入学生信息
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入学生学号：");
        int id = sc.nextInt();
        sc.nextLine();
        System.out.print("请输入学生姓名：");
        String name = sc.nextLine();
        System.out.print("请输入学生年龄：");
        int age = sc.nextInt();
        sc.nextLine();
        System.out.print("请输入学生居住地：");
        String address = sc.nextLine();

        //创建学生对象
        Student stu = new Student(id, name, age, address);

        //添加到对象集合
        students.add(stu);

        //提示成功
        System.out.println("添加学生成功！");
    }
}
